package cn.akwangl.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Swagger2配置
 *
 * @author youyongkun
 * @date 2021/5/15 11:39 上午
 */
@Configuration
@EnableKnife4j
public class Swagger2 {

    @Bean
    public Docket defaultApi3() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                //分组名称
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("cn.akwangl.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("dubbo-consumer")
                .description("")
                .termsOfServiceUrl("http://localhost:8090/dubbo-consumer")
                .contact(new Contact("@阿坤同学", "https://gitee.com/akwangl_admin", "1764441920@qq.com"))
                .version("1.0")
                .build();
    }


}
